package com.iot.common.utils.device;

import com.iot.common.core.domain.BaseEntity;
import com.iot.common.utils.StringUtils;

import java.util.List;

/**
 * @author Cao.ning
 * @date 2022/5/18
 */
public class TableUtils {

    public static final String tablePrefix = "t_";

    public static String getTableName(Class cls){
        String tableName = tablePrefix + StringUtils.toUnderScoreCase(cls.getSimpleName()).toLowerCase();
        return tableName;
    }

    public static String getTableName(String tbn) {
        tbn = StringUtils.toUnderScoreCase(tbn).toLowerCase();
        if(!tbn.startsWith(tablePrefix)){
            // 没有以t_开头，添加t_
            tbn = tablePrefix + tbn;
        }
        return tbn;
    }
}
